package com.huilian.tool.work.weixin.service.impl;

import com.huilian.tool.common.utils.RestTemplateUtil;
import com.huilian.tool.work.weixin.service.AccountIDService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author ：yjzhang
 * @date ：Created in 2023/1/5 0005 11:19
 * @description：
 * @version: 1.0
 */
@Slf4j
@Service
public class AccountIDServiceImpl implements AccountIDService {

    @Resource
    private RestTemplateUtil restTemplateUtil;

    @Override
    public String useridToOpenuserid(String[] userIds,String accessToken) {
        String url = new StringBuilder("https://qyapi.weixin.qq.com/cgi-bin/batch/userid_to_openuserid?access_token=")
                .append(accessToken).toString();
        Map<String, Object> map = new HashMap<>();
        map.put("userid_list",userIds);
        return restTemplateUtil.unifyPost(url, map,String.class);
    }

}
